package com.nstar.orderexpress.commands
{
	import com.adobe.cairngorm.control.CairngormEvent;
	import mx.rpc.IResponder;
	import com.adobe.cairngorm.commands.Command;
	import com.nstar.orderexpress.model.Model;
	import com.nstar.base.util.Logger;
	import com.nstar.components.ErrorView;
	import com.nstar.orderexpress.business.OrderExpressDelegate;
	import com.nstar.orderexpress.control.PurchaseEvent;
	import mx.utils.ObjectUtil;

	public class PurchaseCommand implements Command, IResponder
	{
		private var model:Model = Model.getInstance();
		private var logger:Logger = Logger.getInstance();
				
		public function execute(event:CairngormEvent):void
		{
			//TODO: implement function
			var delegate:OrderExpressDelegate = new OrderExpressDelegate(this);//由代理来调用异步处理方法
			var purchaseEvent:PurchaseEvent = PurchaseEvent(event);
			delegate.insertOrderInfo(purchaseEvent.requestVO);
			
		}
		
		public function result(data:Object):void
		{
			//TODO: implement function
			//data:返回的是订单号order_id
			
			
		}
		
		public function fault(info:Object):void
		{
			//TODO: implement function
			ErrorView.showErrorView(info);
		}
		
	}
}